<?php

namespace app\api\controller;

class UserController extends DefaultController
{

    function infoAction()
    {
        $data = array();
        $data["message"] = "";

        $result = array();
        $result["id"] = "4291d7da9005377ec9aec4a71ea837f";
        $result["name"] = "唯一";
        $result["username"] = "admin";
        $result["password"] = "";
        $result["avatar"] = "/avatar24444.jpg";
        $result["status"] = 1;
        $result["telephone"] = "";
        $result["lastLoginIp"] = "27.154.74.117";
        $result["lastLoginTime"] = "1534837621348";
        $result["creatorId"] = "admin";
        $result["createTime"] = "1534837621348";
        $result["merchantCode"] = "TLif2btpzg079h15bk";
        $result["deleted"] = 0;
        $result["roleId"] = "admin";

        $role = array();
        $role["id"] = "admin";
        $role["name"] = "管理员";
        $role["describe"] = "拥有所有权限";
        $role["status"] = 1;
        $role["creatorId"] = "system";
        $role["createTime"] = 1497160610259;
        $role["deleted"] = 0;

        $permissions = array();
        $permissions[] = array(
            "roleId" => "admin",
            "permissionId" => "dashboard",
            "permissionName" => "仪表盘",
            "actionList" => null,
            "dataAccess" => null,
            "actions" => "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]"
        );
        $permissions[] = array(
            "roleId" => "admin",
            "permissionId" => "system",
            "permissionName" => "仪表盘",
            "actionList" => null,
            "dataAccess" => null,
            "actions" => "[{\"action\":\"add\",\"defaultCheck\":false,\"describe\":\"新增\"},{\"action\":\"query\",\"defaultCheck\":false,\"describe\":\"查询\"},{\"action\":\"get\",\"defaultCheck\":false,\"describe\":\"详情\"},{\"action\":\"update\",\"defaultCheck\":false,\"describe\":\"修改\"},{\"action\":\"delete\",\"defaultCheck\":false,\"describe\":\"删除\"}]"
        );

        $role['permissions'] = $permissions;

        $result["role"] = $role;

        $data["result"] = $result;
        $data["other"] = $_SERVER;

        echo json_encode($data, JSON_UNESCAPED_UNICODE);
        exit();
    }

    function navAction()
    {
        $data = array(
            "message" => "",
            "result" => array(
                array(
                    "name" => "dashboard",
                    "parentId" => 0,
                    "id" => 1,
                    "meta" => array(
                        "icon" => "dashboard",
                        "title" => "仪表盘",
                        "show" => true
                    ),
                    "component" => "RouteView",
                    "redirect" => "/dashboard/workplace"
                ),
                array(
                    "name" => "system",
                    "parentId" => 0,
                    "id" => 2,
                    "meta" => array(
                        "icon" => "dashboard",
                        "title" => "系统管理",
                        "show" => true
                    ),
                    "component" => "RouteView",
                    "redirect" => "/system/module"
                ),
                array(
                    "name" => "module",
                    "parentId" => 2,
                    "id" => 200991,
                    "meta" => array(
                        "icon" => "dashboard",
                        "title" => "应用管理",
                        "show" => true
                    ),
                    "component" => "Module"
                ),
                array(
                    "name" => "workplace",
                    "parentId" => 1,
                    "id" => 7,
                    "meta" => array(
                        "title" => "工作台",
                        "show" => true
                    ),
                    "component" => "Workplace"
                ),
                array(
                    "name" => "monitor",
                    "path" => "https://www.baidu.com/",
                    "parentId" => 1,
                    "id" => 3,
                    "meta" => array(
                        "title" => "监控页（外部）",
                        "target" => "_blank",
                        "show" => true
                    )
                ),
                array(
                    "name" => "form",
                    "parentId" => 0,
                    "id" => 10,
                    "meta" => array(
                        "icon" => "form",
                        "title" => "表单页"
                    ),
                    "redirect" => "/form/base-form",
                    "component" => "RouteView"
                ),
                array(
                    "name" => "basic-form",
                    "parentId" => 10,
                    "id" => 6,
                    "meta" => array(
                        "title" => "基础表单"
                    ),
                    "component" => "BasicForm"
                ),
                array(
                    "name" => "step-form",
                    "parentId" => 10,
                    "id" => 5,
                    "meta" => array(
                        "title" => "分步表单"
                    ),
                    "component" => "StepForm"
                ),
                array(
                    "name" => "advanced-form",
                    "parentId" => 10,
                    "id" => 4,
                    "meta" => array(
                        "title" => "高级表单"
                    ),
                    "component" => "AdvanceForm"
                ),
                array(
                    "name" => "list",
                    "parentId" => 0,
                    "id" => 10010,
                    "meta" => array(
                        "icon" => "table",
                        "title" => "列表页",
                        "show" => true
                    ),
                    "redirect" => "/list/table-list",
                    "component" => "RouteView"
                ),
                array(
                    "name" => "table-list",
                    "parentId" => 10010,
                    "id" => 10011,
                    "path" => "/list/table-list/:pageNo([1-9]\\d*)?",
                    "meta" => array(
                        "title" => "查询表格",
                        "show" => true
                    ),
                    "component" => "TableList"
                ),
                array(
                    "name" => "basic-list",
                    "parentId" => 10010,
                    "id" => 10012,
                    "meta" => array(
                        "title" => "标准列表",
                        "show" => true
                    ),
                    "component" => "StandardList"
                ),
                array(
                    "name" => "fail",
                    "parentId" => 10021,
                    "id" => 10023,
                    "meta" => array(
                        "title" => "失败",
                        "hiddenHeaderContent" => true,
                        "show" => true
                    ),
                    "component" => "ResultFail"
                ),
                array(
                    "name" => "exception",
                    "parentId" => 0,
                    "id" => 10024,
                    "meta" => array(
                        "title" => "异常页",
                        "icon" => "warning",
                        "show" => true
                    ),
                    "redirect" => "/exception/403",
                    "component" => "RouteView"
                ),
                array(
                    "name" => "403",
                    "parentId" => 10024,
                    "id" => 10025,
                    "meta" => array(
                        "title" => "403",
                        "show" => true
                    ),
                    "component" => "Exception403"
                ),
                array(
                    "name" => "404",
                    "parentId" => 10024,
                    "id" => 10026,
                    "meta" => array(
                        "title" => "404",
                        "show" => true
                    ),
                    "component" => "Exception404"
                ),
                array(
                    "name" => "500",
                    "parentId" => 10024,
                    "id" => 10027,
                    "meta" => array(
                        "title" => "500",
                        "show" => true
                    ),
                    "component" => "Exception500"
                ),
                array(
                    "name" => "account",
                    "parentId" => 0,
                    "id" => 10028,
                    "meta" => array(
                        "title" => "个人页",
                        "icon" => "user",
                        "show" => true
                    ),
                    "redirect" => "/account/center",
                    "component" => "RouteView"
                ),
                array(
                    "name" => "center",
                    "parentId" => 10028,
                    "id" => 10029,
                    "meta" => array(
                        "title" => "个人中心",
                        "show" => true
                    ),
                    "component" => "AccountCenter"
                ),
                array(
                    "name" => "settings",
                    "parentId" => 10028,
                    "id" => 10030,
                    "meta" => array(
                        "title" => "个人设置",
                        "hideHeader" => true,
                        "hideChildren" => true,
                        "show" => true
                    ),
                    "redirect" => "/account/settings/basic",
                    "component" => "AccountSettings"
                ),
                array(
                    "name" => "BasicSettings",
                    "path" => "/account/settings/basic",
                    "parentId" => 10030,
                    "id" => 10031,
                    "meta" => array(
                        "title" => "基本设置",
                        "show" => false
                    ),
                    "component" => "BasicSetting"
                ),
                array(
                    "name" => "SecuritySettings",
                    "path" => "/account/settings/security",
                    "parentId" => 10030,
                    "id" => 10032,
                    "meta" => array(
                        "title" => "安全设置",
                        "show" => false
                    ),
                    "component" => "SecuritySettings"
                ),
                array(
                    "name" => "CustomSettings",
                    "path" => "/account/settings/custom",
                    "parentId" => 10030,
                    "id" => 10033,
                    "meta" => array(
                        "title" => "个性化设置",
                        "show" => false
                    ),
                    "component" => "CustomSettings"
                ),
                array(
                    "name" => "BindingSettings",
                    "path" => "/account/settings/binding",
                    "parentId" => 10030,
                    "id" => 10034,
                    "meta" => array(
                        "title" => "账户绑定",
                        "show" => false
                    ),
                    "component" => "BindingSettings"
                ),
                array(
                    "name" => "NotificationSettings",
                    "path" => "/account/settings/notification",
                    "parentId" => 10030,
                    "id" => 10034,
                    "meta" => array(
                        "title" => "新消息通知",
                        "show" => false
                    ),
                    "component" => "NotificationSettings"
                )),
            "status" => 200,
            "timestamp" => 1534844188679
        );

        echo json_encode($data, JSON_UNESCAPED_UNICODE);
        exit();
    }
}